package com.loong.nnm.controller;

import com.loong.nnm.entity.performance.Performance;
import com.loong.nnm.services.PerformanceServices;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class PerformanceController {

    @Resource
    PerformanceServices performanceServices;

    @GetMapping("/node/{node}/performances")
    public String getPerformances(@PathVariable String node) {
        System.out.println(node);
        return performanceServices.getPerformances(node);
    }

    @GetMapping("/node/{node}/performances/current")
    public String getCurrentPerformances(@PathVariable String node, @RequestBody Performance performance) {
        System.out.println(node);
        return performanceServices.getCurrentPerformances(node, performance);
    }

    @RequestMapping("/node/{node}/performances/current")
    public String getHistoryPerformances(@PathVariable String node, @RequestBody Performance performance) {
        System.out.println(node);
        System.out.println("=============================================");
        System.out.println(performance);
        System.out.println("=============================================");
        return performanceServices.getHistoryPerformances(node, performance);
    }
}
